<template>
	<view class="comment">
		<uni-list class="list" v-for="(item,index) in comments" :key="item.id">
				<uni-list-item :title="item.nickname" :note="item.gmtModified" 
								:thumb="item.avatar"
								thumb-size="base"   >
							
				</uni-list-item>
				<text>{{item.content}}</text>	
		</uni-list>
		<view v-if="comments.length==0">没有评论</view>
		
	</view>
	<view class="foot"></view>
</template>

<script setup>
import {apiGetComments} from "@/apis/comment.js"

const props=defineProps({
	course:{}
	
})



const commentVo=ref({
	currentPage:1,
	pageSize:5,
	courseId:props.course.id,
	
})

const comments=ref([])

const getComments=async ()=>{
	console.log("========getComments======");
	console.log(commentVo.value);
	let res=await apiGetComments(commentVo.value)
	comments.value=res.data.data.records
	console.log("===================评论信息======================");
	console.log(comments.value);
}
//const emit = defineEmits(['getComments']);
getComments()
defineExpose({getComments });

</script>

<style lang="scss" scoped>
.comment{
	width:100%;
	.list{
		width: 100%;
		uni-list-item {
		  width: 100%;
		}
		
	}
}

.foot{
	height: 230rpx;
}

</style>